<template>
  <div>
    <h1>温州理工滨海校区</h1>
    <input v-model="studentId" placeholder="请输入学号" />
    <button @click="searchStudent">搜索</button>
    <div v-if="student">
      <p>学号: {{ student.id }}</p>
      <p>姓名: {{ student.name }}</p>
      <p>年龄: {{ student.age }}</p>
      <p>专业: {{ student.major }}</p>
    </div>
    <nav>
      <router-link :to="{ name: 'CampusBinhai' }" exact-active-class="active">滨海</router-link> |
      <router-link :to="{ name: 'CampusChashan' }" exact-active-class="active">茶山</router-link> |
      <router-link :to="{ name: 'CampusYueqing' }" exact-active-class="active">乐清</router-link> |
      <router-link :to="{ name: 'StudentSystem' }" exact-active-class="active">学生管理系统</router-link>
    </nav>
  </div>
</template>

<script>
export default {
  name: 'CampusBinhai',
  data() {
    return {
      studentId: '',
      student: null
    };
  },
  methods: {
    searchStudent() {
      // 假设这里是一个异步请求
      this.student = {
        id: this.studentId,
        name: '李小明',
        age: 18,
        major: '计算机科学'
      };
    }
  }
};
</script>

<style scoped>
.active {
  color: green;
}
</style>
